%%Iыамма памтекопоукоу аел:883


%  %%%Askhsh 1
% disp('Askhsh 1')
% pause;
%
% %estw dianysma b to opoio anhkei sto xwro sthlwn tou pinaka A.
% %afou o A exei grammika anexarthtes sthles estw
% % b = [ 1 0 1 ]'
% disp('h or8ogwnia provolh P sto xwro sthlwn tou A')
% A = [1 0; 0 1; 1 0];
% b = [ 1 0 1 ]';
% x = inv(A'* A)* A'*b;
% A*x
%
% %estw dianysma z to opoio anhkei sto xwro sthlwn tou pinaka B.
% %afou o A exei grammika anexarthtes sthles estw
% % z = [ 1 0 1 ]'
% disp('h or8ogwnia provolh P sto xwro sthlwn tou B')
% B = [1 2; 0 1; 1 0];
% z = [ 1 0 1 ]';
% y = inv(B'* B)* B'*z;
% B*y
 
% A = [1 0; 0 1; 1 0];
% a = [1 2 3]'; % Vector to project
% figure(1); clf; hold on;
% drawVector(a, 'r.', {'a'}); % Plot the vectors
% P_orth = A*A'; % Orthogonal projector
% a_orth = P_orth *a; % Orthogonal projection
% drawVector(a_orth, 'b.', {'a_{orth}'}) % Plot the projections of vector a
% drawSpan(A)
% hold off
% view(150, 15)
 
% B = [1 2; 0 1; 1 0];
% a = [1 2 3]'; % Vector to project
% n = [-.5 6 3]';% Vector for the oblique projection
% figure(1); clf; hold on;
% drawVector(a, 'r.', {'a'}); % Plot the vectors
% drawVector(n, 'g.')
% P_orth = B*B'; % Orthogonal projector
% P_oblique = B*[1 0 0;0 1 0]*inv([B n]); % Oblique projector
% a_orth = P_orth *a; % Orthogonal projection
% a_oblique = P_oblique*a; % Oblique projection
% drawVector([a_orth, 'b.', {'a_{orth}'}) % Plot the projections of vector a
% drawSpan(B)
% hold off
% view(150, 15)
 
%  %%%Askhsh 2
% disp('Askhsh 2')
% pause;
 
% A = [1 0; 0 1; 1 0];
% a = [1 2 3]'; % Vector to project
% n = [-.5 6 3]';% Vector for the oblique projection
% figure(1); clf; hold on;
% drawVector(a, 'r.', {'a'}); % Plot the vectors
% P_oblique = A*[1 0 0;0 1 0]*inv([A n]); % Oblique projector
% a_oblique = P_oblique*a; % Oblique projection
% drawVector([a_oblique], 'b.', {'a_{oblique}'}) % Plot the projections of
vector a
% drawSpan(A)
% hold off
% view(150, 15)
 
% B = [1 2; 0 1; 1 0];
% a = [1 2 3]'; % Vector to project
% n = [-.5 6 3]';% Vector for the oblique projection
% figure(1); clf; hold on;
% drawVector(a, 'r.', {'a'}); % Plot the vectors
% P_oblique = B*[1 0 0;0 1 0]*inv([B n]); % Oblique projector
% a_oblique = P_oblique*a; % Oblique projection
% drawVector([a_oblique], 'b.', {'a_{oblique}'}) % Plot the projections of
vector a
% drawSpan(B)
% hold off
% view(150, 15)
 
 % %  %%%Askhsh 4
%  disp('Askhsh 4')
%  pause;
%
% A = [1 3 -2; 8 0 1; 2 2 6 ];
% B = reshape(1:9,3,3);
% X1 = sampleUnitSphere(3,200);
% X2 = sampleUnitSphere(3,200);
% AX1 = A*X1;
% BX2= B*X2;
% figure(1); clf;
% hold on;
% plot3( X1(1,:), X1(2,:), X1(3,:),'b.'); view(-60,10)
% plot3(AX1(1,:),AX1(2,:),AX1(3,:),'g.');
% plot(BX2(1,:),BX2(2,:),'k.');
% drawVector(AX1, 'r.')
% drawVector(BX2, 'r.')
% hold off;
% axis square equal; grid on;
 
 
%  %%%Askhsh 5
% disp('Askhsh 5')
% pause;
%
% x= [1 1 1]';
% A = diag([1 2 3]);
% norm(A*x)
%
% B = [1 3 -2; 8 0 1; 2 2 6 ];
% norm(B*x)
 
%  %%%Askhsh 6
% disp('Askhsh 6')
% pause;
%
% A = [1 3 -2; 8 0 1; 2 2 6 ];
% B = reshape(1:9,3,3);
%
% a = norm(A(:),2);
% b = norm(B(:),2);
% X = a*b
% AB= A*B;
% ab= norm(AB(:),2)
 
 
% %%%orthogwnies provoles
% disp('orthogwnies provoles')
% pause;
